home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
utils
/
whtday11.arj
/
WHATDAY.DOC
< prev
Wrap
Text File
|
1993-10-09
|
5KB
|
162 lines
WhatDay v.1.1
Batch File Utility
FREEWARE by Platypus Programming
WhatDay generates an ERRORLEVEL code based on what day of the
week it is. "Huh?", you say? Put WhatDay in a batch file and
you can run certain things on certain days. The program will
(very quickly) run and leave an ERRORLEVEL in it's wake (0 is
returned for Sunday, 6 for Saturday);
Here's what the DOS 6.0 help has to say about IF ERRORLEVEL:
Syntax: IF ERRORLEVEL number command
ERRORLEVEL number specifies a true condition
only if the previous program run by
COMMAND.COM returned an exit code equal to or
greater than number
Ahhh...leave it to Microsoft <g>. The important thing to glean
from that is that you need to process the errorlevel BACKWARDS.
The next dealoid is a batch file that should explain it all.
REM ****************
REM START BATCH FILE
REM ****************
@echo off
REM Note that WhatDay v.1.1 already outputs a message with the
REM day of the week, so this batch file is useful only as
REM an example.
whatday
if errorlevel 6 goto Saturday
if errorlevel 5 goto Friday
if errorlevel 4 goto Thursday
if errorlevel 3 goto Wednesday
if errorlevel 2 goto Tuesday
if errorlevel 1 goto Monday
if errorlevel 0 goto Sunday
:Sunday
echo Today is Sunday!
goto end
:Monday
echo Today is Monday!
goto end
:Tuesday
echo Today is Tuesday!
goto end
:Wednesday
echo Today is Wednesday!
goto end
:Thursday
echo Today is Thursday!
goto end
:Friday
echo Today is Friday!
goto end
:Saturday
echo Today is Saturday!
goto end
:end
REM ****************
REM END BATCH FILE
REM ****************
Note that the initial processing of the errorlevel was done
backwards and that goto end was in each little subroutine.
This program could have a large variety of different uses. Why
don't you drop us a line and let us know how YOU'RE using it?
If you're still stymied, here's the actual AUTOEXEC.BAT from my
C:\. This is a real-life batch file:
REM ********************************
REM Here is the real-life batch file
REM ********************************
@echo off
\utils\whatday
if errorlevel == 6 C:\DOS\chkdsk f:
if errorlevel == 5 C:\DOS\chkdsk c:
if errorlevel == 4 C:\DOS\chkdsk d:
if errorlevel == 3 C:\DOS\chkdsk c:
if errorlevel == 2 C:\DOS\chkdsk d:
if errorlevel == 1 C:\DOS\chkdsk c:
if errorlevel == 0 C:\DOS\chkdsk d:
goto %config%
:Scrn
c:\utils\saveit
alias /R c:\dos\alist
SET NU=C:\NORTON
prompt $e[0;32m$P$G$e[1;34mBlat.$e[0;32m$g$e[0m
PATH F:\TC\BIN;C:\BELFRY;C:\NORTON;C:\UTILS;C:\DOS;C:\;C:\WWIV
goto end
:NDos
alias /R c:\dos\alist
SET NU=C:\NORTON
prompt $e[0;32m$P$G$e[1;34mBlat.$e[0;32m$g$e[0m
PATH F:\TC\BIN;C:\BELFRY;C:\NORTON;C:\UTILS;C:\DOS;C:\;C:\WWIV;
goto end
:end
REM ***************************
REM End of real-life batch file
REM ***************************
What this batch file does is run CHKDSK on one of my drives each
day at boot-up. A different drive is tested each day! Again, I
hope you'll write to us and tell us how YOU have used WhatDay.
COPYRIGHT STUFF
───────────────
This program, while owned and copyrighted by Platypus
Programming, is hereby donated to the public domain at no cost
to you, the user. The one requirement we have is that if you
distribute it, keep WHATDAY.COM, WHATDAY.DOC, and FILE_ID.DIZ
together either on a diskette or in an archive file called
WHTDAY11.ZIP.
We have several other shareware and freeware programs we hope
you'll check out. For a diskette with all our stuff, send $2
to:
Platypus Programming
P.O. Box 6095
Terre Haute, IN 47804-2318
Send all comments to that address, as well, or call Insomnia BBS
at 812-466-4222, the official home of Platypus Programming. We
can also be reached at the following network addresses:
1@18262 WWIVLink 1@8265 WWIVNet 1@2001 ASSnet
michael.lerch@hal9k.com internet
HISTORY OF WHATDAY
──────────────────
V.1.0 - Released 6/28/93. Written in .C
v.1.1 - Released 10/9/93. Written in .ASM. MUCH smaller while
doing more! Now in addition to returning the day of the
week as an ERRORLEVEL it will say what day it is right
on the screen. A couple people mailed me saying they
freaked out a little bit when they'd run the program,
see a banner, but nothing would happen!